package com.lsc.www.day04;

import java.util.Scanner;

public class MethodTest04 {
    //计算1-n的和
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sum(n);
        System.out.println(r);
        m(9);

    }

    public static void m(int i){
        if(i==1){
            System.out.println("1*1=1");
        }else {
            m(i-1);
            for (int j = 1 ; j <=i ; j++){
                System.out.print(j + "*" + i + "=" + (j*i) + "\t");
            }
            System.out.println();
        }
    }


    public static int sum(int n){// int n =4 // int n =  3 // int n = 2

        if(n==1){
            return 1; //1
        }
        System.out.println(n);

        return n+sum(n-1);        // 4+4-1  // 3+3-1 // 2+2-1
    }



    //错误示范 方法的递归一定要给好限制,否则一直递归下去会报错
//    public static void a(){
//        System.out.println("123");
//        a();
//
//    }
}
